package com.rgsx.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Verify {
    public static boolean verifyPhone(String phone){
        try {
            String regex = "0\\d{2,3}[-]?\\d{7,8}|0\\d{2,3}\\s?\\d{7,8}|13[0-9]\\d{8}|15[1089]\\d{8}";
            Pattern pattern = Pattern.compile(regex);    // 编译正则表达式
            Matcher matcher = pattern.matcher(phone);
            if(matcher.matches()){
               return true;
            }
            return false;
        } catch (Exception e) {
            return false;
        }
    }
}
